class Solution
{
public:
    int maxArea(int h, int w, vector<int> &horizontalCuts, vector<int> &verticalCuts)
    {
        horizontalCuts.push_back(0);
        horizontalCuts.push_back(h);
        sort(horizontalCuts.begin(), horizontalCuts.end());

        verticalCuts.push_back(0);
        verticalCuts.push_back(w);
        sort(verticalCuts.begin(), verticalCuts.end());

        int maxDiffH = 0;
        for (int i = 1; i < horizontalCuts.size(); ++i)
        {
            int diffH = horizontalCuts[i] - horizontalCuts[i - 1];
            if (diffH > maxDiffH)
            {
                maxDiffH = diffH;
            }
        }

        int maxDiffW = 0;
        for (int i = 1; i < verticalCuts.size(); ++i)
        {
            int diffW = verticalCuts[i] - verticalCuts[i - 1];
            if (diffW > maxDiffW)
            {
                maxDiffW = diffW;
            }
        }

        return static_cast<int>((static_cast<long long>(maxDiffH) * static_cast<long long>(maxDiffW)) % 1000000007LL);
    }
};